#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "AD.h"

uint16_t value = 0;
float voltage = 0;

int main(void)
{
	OLED_Init();
	AD_Init();
	OLED_ShowString(1, 1, "Value:0000");
	OLED_ShowString(2, 1, "Voltage:0.00V");
	while (1)
	{
		value = AD_ValueGet();
		OLED_ShowNum(1, 7, value, 4);
		voltage = value / 4095.0 * 3.3;
		OLED_ShowNum(2, 9, voltage, 1);
		OLED_ShowNum(2,11, (uint16_t)(voltage * 100) % 100, 2);
	}
}
